define(['modules','jquery'],function(controllers,$){
   controllers.controller('modalController',function($scope){ 
    function modalBox(target,direction,playtime,modal_box){
      var startObj = {'display':'block','opacity':'0'}
      startObj[direction] = '0';
      var endObj = {'opacity':1,'top':'30%'};
      endObj[direction] = '30%';
      var closeObj = {'display':'none'};
      closeObj[direction] = '';
    $(target).click(function(direction){
    $('.modal_opacity').css('display','block');
    $(modal_box).css(startObj);
    $(modal_box).animate(endObj,playtime);
    $('.close').click(function(){
      $('.modal_opacity').css('display','none');
      $(modal_box).css(closeObj);
     })
   }) 
   return false 
 } 
 modalBox('.modal_top','top',500,'.modal_box');
 modalBox('.modal_right','right',500,'.modal_box');
 modalBox('.modal_bottom','bottom',500,'.modal_box');
 modalBox('.modal_left','left',500,'.modal_box')
})
})
